<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <title>你好，C先生</title>
        
    <!-- <link href="admin/bootstrap.min.css" rel="stylesheet"> -->
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="admin/animate.css" rel="stylesheet">
    <link href="admin/style.css" rel="stylesheet">
    <meta name="keywords" content="Scott Jeremy" />
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <h3>管理员登陆</h3>
        <form class="m-t" role="form" action="login.html">
            <div class="form-group">
                <input type="text" class="form-control" id="username" placeholder="请输入用户名" required="">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" id="password" placeholder="请输入注册密码" required="">
            </div>

            <input type="button" id="login" class="btn btn-primary block full-width m-b" value="登陆">
        </form>
        <!-- <p class="m-t"> <small>Copyright &copy; 2018.Scott All rights reserved.</small> </p> -->
    </div>
</div>

<!-- Mainly scripts -->
<script src="admin/jquery-2.1.1.js"></script>
<script src="admin/bootstrap.min.js"></script>

<script>
    //用ajax提交表单
    $('#login').click(function () {
        $.post("/doLogin",{
            "username" : $("#username").val(),
            "password" : $("#password").val()

        },function (result) {
            if(result == "1"){
                window.location.href = "/recording";
            }else if(result == "-2"){
                alert("密码错误");
            }else if(result == "-1"){
                alert("没有该用户");
            }else if(result == "-3"){
                alert("服务器错误！");
            }else{
                alert("未知原因，登陆失败");
            }
        });

    });
</script>

</body>

</html>
